﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Tasks.aspx.cs" Inherits="Actuals.Tasks" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="head1" runat="server">
    <link href="~/Actuals.css" rel="Stylesheet" type="text/css" />
    <link href="~/themes/ui-lightness/jquery.ui.all.css" rel="stylesheet" type="text/css" />
    <title>Tasks</title>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.ui.datepicker.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.ui.core.js") %>"></script>
    <script type="text/javascript">
        function ShowAddTasks() {
            var result = window.showModalDialog('AddTasks.aspx', this,
                'dialogHeight:500px;dialogWidth:500px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
            __doPostBack('refresh', 'refresh');
        }
        function ShowUpdateAddTasks(taskId) {

            var url = 'AddTasks.aspx?Mode=Edit&TaskId=' + taskId;


            var result = window.showModalDialog(url, this,
                'dialogHeight:700px;dialogWidth:500px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
            __doPostBack('refresh', 'refresh');
        }


     /*   var Target = null;
        window.onload = function () {
            try {
                debugger;

                Target = document.getElementById('<% =this.gvResults.ClientID %>');

            }
            catch (e) {
                Target = null;
            }

        }*/
        function TestCheckBox() {
            debugger;
            var Target = null;
            Target = document.getElementById('<% =this.gvResults.ClientID %>');
            if (Target == null) {
                alert("no record is selected.Please select!");
                return false;
            }
            var Inputs = Target.getElementsByTagName("input");
            for (var n = 0; n < Inputs.length; ++n) {
                if (Inputs[n].type == 'checkbox' && Inputs[n].checked) {
                    return confirm("Do you want to Delete?");
                }
            }
            alert("no record is selected.Please select!");
            return false;
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <center>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div id="divTasks" runat="server">
                    <asp:Label ID="lblMsg" runat="server" CssClass="message"> </asp:Label>
                    <table>
                        <tr>
                            <td>
                                <asp:Label ID="lblProject" runat="server" CssClass="label">Project</asp:Label>
                            </td>
                            <td align="left">
                                <asp:DropDownList ID="ddlProject" runat="server" CssClass="textfield" AutoPostBack="true"
                                    OnSelectedIndexChanged="ddlProject_OnSelectedIndexChanged">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Label ID="lblRelease" runat="server" CssClass="label">Release</asp:Label>
                            </td>
                            <td align="left">
                                <asp:DropDownList ID="ddlRelease" runat="server" CssClass="textfield ">
                                </asp:DropDownList>
                            </td>
                            <td>
                                <asp:Button ID="btnGetTasks" Text="GetTasks" runat="server" OnClick="btnGetTasks_Click" />
                            </td>
                        </tr>
                    </table>
                </div>
                <div runat="server" id="div1">
                    <div id="div2" style="border: solid 1px silver; height: 520px; text-align: center;
                        overflow-x: hidden; overflow-y: auto;">
                        <asp:GridView ID="gvResults" AutoGenerateColumns="false" BorderColor="Black" runat="server"
                            AllowSorting="true" OnRowCommand="gvResults_OnRowCommand">
                            <HeaderStyle BackColor="White" Font-Size="10px" ForeColor="#990000" BorderStyle="None" />
                            <RowStyle BackColor="#F7F3F7" Font-Names="Verdana" Font-Size="XX-Small" BorderStyle="None" />
                            <AlternatingRowStyle BackColor="White" Font-Names="Verdana" Font-Size="XX-Small"
                                BorderStyle="None" />
                            <Columns>
                                <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                                    HeaderStyle-BorderStyle="None">
                                    <ItemTemplate>
                                        <asp:CheckBox runat="server" ID="chkTask" AutoPostBack="true" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField Visible="false">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTaskId" runat="server" Text='<%#Bind("TaskId") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="TaskType">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTaskType" runat="server" Text='<%# Bind("TaskType") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="TaskShortName">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTaskShortName" runat="server" Text='<%# Bind("TaskShortName") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Description">
                                    <ItemTemplate>
                                        <asp:Label ID="lblDescription" runat="server" Text='<%# Bind("Description") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Status">
                                    <ItemTemplate>
                                        <asp:Label ID="lblStatus" runat="server" Text='<%# Bind("Status") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="InitialEstimation">
                                    <ItemTemplate>
                                        <asp:Label ID="lblInitialEstimation" runat="server" Text='<%# Bind("InitialEstimation") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="CurrentEstimation">
                                    <ItemTemplate>
                                        <asp:Label ID="lblCurrentEstimation" runat="server" Text='<%# Bind("CurrentEstimation") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                                    HeaderStyle-BorderStyle="None">
                                    <ItemTemplate>
                                        <asp:Button CausesValidation="false" CommandName="EditActual" runat="server" ID="btnEdit"
                                            Text="Edit" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "TaskId") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        <div>
            <asp:Button ID="btnAddTasks" runat="server" CssClass="button" Text="AddTasks" OnClientClick="return ShowAddTasks()" />
            <asp:Button ID="btnDeleteTasks" runat="server" CssClass="button" Text="Delete" OnClientClick="return TestCheckBox()"
                OnClick="btnDeleteTask_Click" />
        </div>
    </center>
    </form>
</body>
</html>
